package com.xiaojiang.controller;

import cn.dev33.satoken.util.SaResult;
import com.xiaojiang.dto.QueryCarRecordsDto;
import com.xiaojiang.dto.QueryPersonRecordsDto;
import com.xiaojiang.service.RecordsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 功能：
 * 作者：小江
 * 日期：2024年10月25日
 */
@RestController
@RequestMapping("/api")
public class RecordsController {

    @Autowired
    private RecordsService recordsService;

    @GetMapping("/queryPersonRecords")
    public SaResult queryPersonRecords(@RequestParam Integer currentPage, @RequestParam Integer pageSize){
        QueryPersonRecordsDto queryPersonRecordsDto = new QueryPersonRecordsDto();
        queryPersonRecordsDto.setCurrentPage(currentPage);
        queryPersonRecordsDto.setPageSize(pageSize);
        return recordsService.queryPersonRecords(queryPersonRecordsDto);
    }

    @GetMapping("/queryCarRecords")
    public SaResult queryCarRecords(@RequestParam Integer currentPage, @RequestParam Integer pageSize){
        QueryCarRecordsDto queryCarRecordsDto = new QueryCarRecordsDto();
        queryCarRecordsDto.setCurrentPage(currentPage);
        queryCarRecordsDto.setPageSize(pageSize);
        return recordsService.queryCarRecords(queryCarRecordsDto);
    }

}
